package nc.ws.impl; 
	import java.io.File;
	import java.text.SimpleDateFormat;
	import java.util.ArrayList;
	import java.util.Date;
	import java.util.List;

	import javax.xml.parsers.DocumentBuilder;
	import javax.xml.parsers.DocumentBuilderFactory;

	import org.dom4j.Document;
	import org.dom4j.Element;
	import org.dom4j.io.SAXReader;

	import com.soa.eis.adapter.framework.message.IMsgObject;
	import com.soa.eis.adapter.framework.message.impl.GroupRecord;
	import com.soa.eis.adapter.framework.message.impl.MsgObject;
	import com.soa.eis.adapter.framework.utils.log.LogUtil;

import groovy.util.NodeList;
	 
	 
	public class OA_HTTP_GET_MDM {
	

		public static void main(String[] args) throws Exception {
			@SuppressWarnings("unused")
			String mil=String.valueOf(System.currentTimeMillis());
			//String sHttpPost = "http://10.112.0.206:7080/httpservice";
			String sHttpPost ="http://10.112.5.143:7080/httpservice";
			IMsgObject reqMo = new MsgObject(IMsgObject.MOType.initSR);
			String SourceSysID = "06002";              //请求方(发布方) 系统号    OA  
			String ServiceID = "06009100000007"; //响应方(发布方) 服务号    MDM
			//获取系统时间
			Date date = new Date();
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
			String format = simpleDateFormat.format(date);
			//对请求报文对象进行设置
			reqMo.setSourceSysID(SourceSysID); //设置报文 请求方系统号      
			reqMo.setServiceID(ServiceID);     //设置报文 提供方服务号

			reqMo.setSerialNO(format.substring(0, 8)+SourceSysID+System.currentTimeMillis());//设置报文流水号,第三段表示今天发送的第几的一次报文
			reqMo.setServiceDateTime(format);  //设置报文 日期时间

			reqMo.setControlValue("Username", "GUESTERM");
			reqMo.setControlValue("Password", "GUESTERM");
		

			
		List<GroupRecord> grs1 = new ArrayList<GroupRecord>();

			GroupRecord gr1 = new GroupRecord();
			//gr1.setFieldValue("string","084655");
		
	 	reqMo.setReqGroupRecord(grs1);
		
		//打印请求报文对象
//		LogUtil.getInstance().info(reqMo);
			
		System.out.println("Begin:1111111111111111111111111111111111111111111");
			System.out.println(reqMo);
		
			
			System.out.println("END!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
			IMsgObject respMo = null;
//			IServiceRequester  mt = new BaseServiceRequester();
	 		
			//直接访问WSDL调用方法
			MYWSServiceRequester mt = new MYWSServiceRequester(sHttpPost);
			respMo = mt.execute(reqMo);
//			respMo=ZY_HTTP_By_URL_Visit_MES.execute(reqMo,sHttpPost);
			System.out.println(	"*****"+respMo );
			List<GroupRecord> record2 = respMo.getResGroupRecord("return") ;
			System.out.println(record2 == null ? "is null" : record2.size());
	 		for (GroupRecord record : record2) {
				String fieldValue = record.getFieldValue("psnname");
//				String locator = record.getFieldValue("Name2");
				System.out.println(fieldValue);
//				System.out.println(locator);
	 		}
		System.out.println(">>>>>>>>>>>>>>");
		}

	}

